package com.yuanqi.springboot_banksystem.entity;

import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
public class UserEntity extends BaseEntity{

    private Integer uid;

    private String username;

    private String password;

    private String salt;

    private Integer is_delete;

    private Double banlance;

    private Integer is_cold;

    private String tel;

    private String role;

    public UserEntity() {
    }

    public UserEntity(Integer uid, String username, String password, String salt, Integer is_delete, Double banlance, Integer is_cold, String tel, String role) {
        this.uid = uid;
        this.username = username;
        this.password = password;
        this.salt = salt;
        this.is_delete = is_delete;
        this.banlance = banlance;
        this.is_cold = is_cold;
        this.tel = tel;
        this.role = role;
    }

    public UserEntity(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public UserEntity(String username, String password, String tel) {
        this.username = username;
        this.password = password;
        this.tel = tel;
    }

    public Integer getUid() {
        return uid;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getSalt() {
        return salt;
    }

    public Integer getIs_delete() {
        return is_delete;
    }

    public Double getBanlance() {
        return banlance;
    }

    public Integer getIs_cold() {
        return is_cold;
    }

    public String getTel() {
        return tel;
    }

    public String getRole() {
        return role;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public void setIs_delete(Integer is_delete) {
        this.is_delete = is_delete;
    }

    public void setBanlance(Double banlance) {
        this.banlance = banlance;
    }

    public void setIs_cold(Integer is_cold) {
        this.is_cold = is_cold;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public void setRole(String role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "UserEntity{" +
                "uid=" + uid +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", is_delete=" + is_delete +
                ", banlance=" + banlance +
                ", is_cold=" + is_cold +
                ", tel='" + tel + '\'' +
                ", role='" + role + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserEntity that = (UserEntity) o;
        return Objects.equals(uid, that.uid) && Objects.equals(username, that.username) && Objects.equals(password, that.password) && Objects.equals(salt, that.salt) && Objects.equals(is_delete, that.is_delete) && Objects.equals(banlance, that.banlance) && Objects.equals(is_cold, that.is_cold) && Objects.equals(tel, that.tel) && Objects.equals(role, that.role);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, password, salt, is_delete, banlance, is_cold, tel, role);
    }
}
